import request from '@/utils/request'

// 查询角色列表
export function listTenant(query) {
  return request({
    url: '/system/tenant/page',
    method: 'get',
    params: query
  })
}

// 查询角色详细
export function getTenant(roleId) {
  return request({
    url: '/system/tenant/' + roleId,
    method: 'get'
  })
}

// 查询角色详细
export function listTenantExcelHeader() {
  return request({
    url: '/system/tenant/excel/header',
    method: 'get'
  })
}

// 新增角色
export function addTenant(data) {
  return request({
    url: '/system/tenant',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateTenant(data) {
  return request({
    url: '/system/tenant',
    method: 'patch',
    data: data
  })
}

// 导出角色
export function exportTenant(data, pageParam) {
  return request({
    responseType: 'blob',
    url: '/system/tenant/download/excel' + pageParam,
    method: 'post',
    data: data
  })
}

export function uploadTenant(data) {
  return request({
    url: '/system/tenant/upload/excel',
    method: 'post',
    data: data
  })
}

// 删除角色
export function delTenant(id) {
  return request({
    url: '/system/tenant?id=' + id,
    method: 'delete'
  })
}

export function batchDelTenant(ids) {
  return request({
    url: '/system/tenant/batch',
    method: 'delete',
    data: ids
  })
}
